const webpack = require('webpack');
const plugins = require('webpack-load-plugins')();

module.exports = {
    entry: {
        index: [
            'webpack-dev-server/client?http://localhost:8080',
            'webpack/hot/only-dev-server',
            './src/js/index.jsx'
        ]
    },

    output: {
        path: './build',
        filename: 'bundle.js',
        // publicPath: '/asset/'
    },

    module: {
        loaders: [
            {
                test: /\.css$/,
                loader: 'style!css'
            },
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                loaders: [
                    'react-hot',
                    'babel?presets[]=react&presets[]=es2015'
                ]
            },
            // {
            //     test: /\.jsx?$/,
            //     exclude: /node_modules/,
            //     loader: 'babel',
            //     query: {
            //         presets: ['es2015', 'react']
            //     }
            // },


            // {
            //     test: /\.css$/,
                // loader: plugins.extractText.extract('style-loader', 'css-loader!postcss-loader')
                // loader: plugins.extractText.extract('style-loader', 'css-loader')
            // }
        ]
    },

    plugins: [
        // new plugins.html({
        //   title: 'dev-index',
        //   filename: 'index.html'
        // }),
        // new plugins.extractText('[name].css', {allChunks: true}),
        new webpack.HotModuleReplacementPlugin()
    ],

    resolve: {
        extensions: ['', '.js', '.css', '.scss', '.jsx', '.png', '.jpg']
    }
};
